import { PORT3 } from '@/api/config/servicePort';
import http from '@/api';
import { PublicParams } from '@/api/interface/publicParams';
import { RosterInterface } from '@/api/interface/personnel/roster/roster';
/**
 * @name 花名册
 */

// 提交
export const rosterSubmit = (params: PublicParams.ReqId) => {
  return http.get(PORT3 + `/roster/v1/submit/${params.id}`);
};

// 新增|编辑
export const rosterSave = (params: RosterInterface.ReqRosterSave) => {
  return http.post(PORT3 + `/roster/v1/save`, params);
};

/** 离职 */
export const rosterLeave = (params: RosterInterface.ReqRosterLeave) => {
  return http.post(PORT3 + `/roster/v1/leave`, params);
};

// 修改员工类型
export const rosterChangeType = (params: RosterInterface.ReqRosterChangeType) => {
  return http.post(PORT3 + `/roster/v1/changeType`, params);
};

// 修改员工岗位
export const rosterChangeJob = (params: RosterInterface.ReqRosterChangeJob) => {
  return http.post(PORT3 + `/roster/v1/changeJob`, params);
};
// 分页查询
export const rosterPageList = (params: RosterInterface.ReqRosterPageList) => {
  return http.post<PublicParams.ResPage<RosterInterface.ResRosterPageList[]>>(PORT3 + `/roster/v1/PageList`, params);
};

// 删除
export const rosterDelete = (params: PublicParams.ReqId) => {
  return http.get(PORT3 + `/roster/v1/delete/${params.id}`);
};

// 其他信息========================================

/** 新增|编辑 */
export const otherInfoSave = (params: RosterInterface.ReqOtherInfoSave) => {
  return http.post(PORT3 + `/otherInfo/v1/save`, params);
};

/**查询 */
export const otherInfoList = (params: RosterInterface.ReqListByRosterId) => {
  return http.get<RosterInterface.ResOtherInfoList>(PORT3 + `/otherInfo/v1/list`, params);
};
// ===================家庭信息=====================
/** 新增 */
export const familyInfoSave = (params: RosterInterface.ReqFamilyInfoSave) => {
  return http.post(PORT3 + `/familyInfo/v1/save`, params);
};

/** 查询 */
export const familyInfoListById = (params: RosterInterface.ReqListByRosterId) => {
  return http.get<RosterInterface.ResFamilyInFoListById[]>(PORT3 + `/familyInfo/v1/ListById`, params);
};

/** 删除 */
export const familyInfoDelete = (params: PublicParams.ReqId) => {
  console.log(params, 'params');

  return http.get(PORT3 + `/familyInfo/v1/delete/${params.id}`);
};
// ===================教育信息=====================
/** 新增 */
export const educationInfoSave = (params: RosterInterface.ReqEducationInfoSave) => {
  return http.post(PORT3 + `/educationInfo/v1/save`, params);
};

/** 查询 */
export const educationInfoList = (params: RosterInterface.ReqListByRosterId) => {
  return http.get<RosterInterface.ResEducationInfoList[]>(PORT3 + `/educationInfo/v1/list`, params);
};

/** 删除 */
export const educationInfoDelete = (params: RosterInterface.ReqDelete) => {
  return http.post(PORT3 + `/educationInfo/v1/delete/${params.id}`);
};

// ===================合同信息=====================
/** 合同信息新增 */
export const contractInfoSave = (params: RosterInterface.ReqContractInfoSave) => {
  return http.post(PORT3 + `/contractInfo/v1/save`, params);
};

/** 删除 */
export const contractInfoDelete = (params: RosterInterface.ReqDelete) => {
  return http.post(PORT3 + `/contractInfo/v1/delete`, params);
};

/** 查询 */
export const contractInfoListByRosterId = (params: RosterInterface.ReqListByRosterId) => {
  return http.get<RosterInterface.ResContractInfoListByRosterId[]>(PORT3 + `/contractInfo/v1/ListByRosterId`, params);
};

// ===================财务信息=====================
/** 合同信息新增 */
export const financeInfoSave = (params: RosterInterface.ReqFinanceInfoSave) => {
  return http.post(PORT3 + `/financeInfo/v1/save`, params);
};

/** 财务信息 查询*/
export const financeInfoList = (params: RosterInterface.ReqListByRosterId) => {
  return http.get<RosterInterface.ResFinanceInfoList>(PORT3 + `/financeInfo/v1/list`, params);
};
// ===================工作信息=====================
/**工作信息 新增|编辑 */
export const workInfoSave = (params: RosterInterface.ReqWorkInfoSave) => {
  return http.post(PORT3 + `/workInfo/v1/save`, params);
};

/**工作信息 查询 */
export const workInfoList = (params: RosterInterface.ReqListByRosterId) => {
  return http.get<RosterInterface.ResWorkInfoList[]>(PORT3 + `/workInfo/v1/list`, params);
};

/**工作信息 删除 */
export const workInfoDelete = (params: PublicParams.ReqId) => {
  return http.post(PORT3 + `/workInfo/v1/delete/${params.id}`);
};
